Skip to content

Conversation

@ArtemStepuk
Copy link
Contributor

@ArtemStepuk ArtemStepuk commented Oct 21, 2025

Description

Merge request contains only integration tests.

Covers:

  • Route refresh with default profile
  • Route refresh with custom profile
  • Reroute with default profile
  • Reroute with custom profile
  • Reroute with custom query items

@ArtemStepuk ArtemStepuk changed the title As/core integration tests [Core] Route refresh integration test Oct 21, 2025
@ArtemStepuk ArtemStepuk marked this pull request as ready for review October 31, 2025 11:36
@ArtemStepuk ArtemStepuk requested a review from a team as a code owner October 31, 2025 11:36
]
),
.testTarget(
name: "MapboxCoreNavigationIntegrationTests",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When added as a test target, these tests will be run as a part of required job, as a MapboxNavigation-Package step

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes thank you, that was my intention. On our side we are mocking the network.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed in chat - some tests, might be flaky, let's see on a couple of runs how it acts.

Comment on lines 266 to 267
let mappedUrlItem = queryItems!.first(where: { $0 == .customItem })!
self.customParameters = [mappedUrlItem]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's avoid using unnecessary ! to avoid crashes, even in tests.

Suggested change
let mappedUrlItem = queryItems!.first(where: { $0 == .customItem })!
self.customParameters = [mappedUrlItem]
let mappedUrlItem = queryItems?.first(where: { $0 == .customItem })
self.customParameters = mappedUrlItem.map { [$0] } ?? []

static let customItem: URLQueryItem = .init(name: "foo", value: "bar")
}

fileprivate final class CustomRouteOptions: NavigationRouteOptions {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a class CustomRouteOptions in the TestHelper. Is it possible to reuse it there somehow?

}

func testRouteRefreshWithCustomDrivingTrafficProfile() {
simulateAndTestOnRoute(with: .custom, shouldRefresh: true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please rename .custom to .customDrivingTraffic so it's clear we don't refresh any custom profile, only the custom driving-traffic?

}

func testRouteRefreshWithWalkingProfile() {
simulateAndTestOnRoute(with: .walking, shouldRefresh: false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also add a separate test for
simulateAndTestOnRoute(with: .automobile, shouldRefresh: false)

@ArtemStepuk ArtemStepuk merged commit 57171c2 into lts/v2 Nov 4, 2025
17 of 18 checks passed
@ArtemStepuk ArtemStepuk deleted the as/core-integration-tests branch November 4, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants